package com.liner.test;

public class StaticDemo {
    public static void main(String[] args) {
        StaticVar s1 = new StaticVar();
        s1.show();
        StaticVar s2 = new StaticVar();
        s2.show();
        StaticVar s3 = new StaticVar();
        s3.show();
        // 实例的是1，因为创建几个对象就是创建了几个类
        // 静态的是3 因为一直调用的是同一个

        System.out.println(StaticVar.b);//常常通过类名.访问

        StaticBlock sb1 = new StaticBlock();//加载类时自动执行静态块
        StaticBlock sb2 = new StaticBlock();

        Student student = new Student("Student", 12, "123");
        System.out.println(Student.className + "班的" + student.getName() + "学号是" + student.getStuId() + "今年" + student.getAge() + "岁了");


        System.out.println(Integer.MAX_VALUE);

        //静态方法
        StaticMethod.Test();
        System.out.println(StaticMethod.b);


    }
}
